package com.kt.coroutinedemo.Netty

import android.util.Log
import com.swallowsonny.convertextlibrary.toHexString
import io.netty.buffer.ByteBuf
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.MessageToByteEncoder

/**
 * @Author Xzh
 * @Date 2025/6/6
 * @Description
 */
class ClientEncoder : MessageToByteEncoder<ByteArray>() {

    companion object{
        val  TAG = "ClientEncoder"
    }

    override fun encode(ctx: ChannelHandlerContext?, msg: ByteArray?, out: ByteBuf?) {
        Log.d(TAG, "encode: ${msg?.toHexString()}", )
        out?.writeBytes(msg)
    }
}